package demo.isolib.mousehandler {
	import demo.isolib.Tile;

	/**
	 * Remove tile from world and make the area which the tile placed as walkable.
	 */
	public class Remove extends DummyMouseHandler {
		override public function execute(params:Array):void {
			tile.world.removeTile(tile);
			updateAstarGrid(true);
		}

		/**
		 * Update walkable properties of the world's astargrid
		 * @param	walkable
		 */
		protected function updateAstarGrid(walkable:Boolean):void {
			for (var i:int = 0; i < _tile.colSpan; i++) {
				for (var j:int = 0; j < _tile.rowSpan; j++) {
					_tile.world.astarGrid.setWalkable(_tile.column + i, _tile.row + j, walkable);
				}
			}
		}

	}

}